//
//  CustomTableCellShopCar.m
//  NewApp
//
//  Created by xueyan liu on 6/25/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "CustomTableCellShopCar.h"
#import "NAImageView.h"

@implementation CustomTableCellShopCar


- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}

-(void) setContentWithImage:(NSURL *)imgURL 
                  productNO:(NSString *)productNO 
                      title:(NSString *)title 
                     number:(NSString *)number 
                   subtotal:(NSString *)subtotal{

    NAImageView *imageView = [[NAImageView alloc] initWithFrame:CGRectMake(12, 10, 90, 70)];
    UIImage *img = [g_imageLoader cachedImageForURL:imgURL target:imageView];
    if (img != nil) {
        [imageView didLoadImage:imgURL Image:img];
    }
    
    [self addSubview:imageView];
    [imageView release];
    
    UILabel *lblProductNO = [[UILabel alloc] initWithFrame:CGRectMake(115, 12, 203, 16)];
    lblProductNO.text = [NSString stringWithFormat:@"商品編號:%@",productNO];
    lblProductNO.font = [UIFont fontWithName:@"Arial" size:14];
    [lblProductNO setBackgroundColor:[UIColor clearColor]];
    [self addSubview:lblProductNO];
    [lblProductNO release];
    
    UILabel *lblTitle = [[UILabel alloc] initWithFrame:CGRectMake(115, 31, 203, 15)];
    lblTitle.text = title;
    lblTitle.font = [UIFont fontWithName:@"Arial" size:14];
    [lblTitle setBackgroundColor:[UIColor clearColor]];
    [self addSubview:lblTitle];
    [lblTitle release];
    
    UILabel *lblNumber = [[UILabel alloc] initWithFrame:CGRectMake(115, 49, 203, 15)];
    lblNumber.text = [NSString stringWithFormat:@"數量:%@",number];
    lblNumber.font = [UIFont fontWithName:@"Arial" size:14];
    [lblNumber setBackgroundColor:[UIColor clearColor]];
    [self addSubview:lblNumber];
    [lblNumber release];
    
    UILabel *lblSubtotal = [[UILabel alloc] initWithFrame:CGRectMake(115, 65, 203, 15)];
    lblSubtotal.text = [NSString stringWithFormat:@"小計:$%@",subtotal];
    lblSubtotal.font = [UIFont fontWithName:@"Arial" size:14];
    [lblSubtotal setBackgroundColor:[UIColor clearColor]];
    [self addSubview:lblSubtotal];
    [lblSubtotal release];
    
    /*
    UIButton *btDelete = [UIButton buttonWithType:UIButtonTypeCustom];
    [btDelete setFrame:CGRectMake(300, 58, 16, 16)];
    [btDelete setImage:[UIImage imageNamed:@"delete_icon"] forState:UIControlStateNormal];

    [btDelete addTarget:delegate action:deleteAction forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:btDelete];
     */
    //[btDelete release];

}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
